﻿using System;
using System.Linq;
using System.Collections.Generic; 
using System.Data;
using Matrix.Common.Utility;
using Matrix.MaKaYunShang.Model;
using Matrix.MaKaYunShang.DAL;

namespace Matrix.MaKaYunShang.BLL
{
	public partial class ShopNoticeBLL : BaseBLL<ShopNoticeBLL>
	{
		#region 默认方法
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(ShopNotice model)
		{
			return ShopNoticeDAL.Instance.Add(model);		
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ShopNotice model)
		{
			return ShopNoticeDAL.Instance.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int Id)
		{			
			return ShopNoticeDAL.Instance.Delete(Id);
		}
				/// <summary>
		/// 批量删除一批数据
		/// </summary>
		public bool DeleteList(string Idlist )
		{
			return ShopNoticeDAL.Instance.DeleteList(Idlist );
		}
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public ShopNotice GetModel(int Id)
		{
			var ds = ShopNoticeDAL.Instance.GetModel(Id);
            return ds == null ? null : ServicesHelper.DataSetToIList<ShopNotice>(ds).ToList()[0];
		}
		
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<ShopNotice> GetModelList(string strWhere = null)
		{
			var ds = ShopNoticeDAL.Instance.GetList(strWhere);
			return ServicesHelper.DataSetToIList<ShopNotice>(ds).ToList();
		}
		#endregion
		
		#region 扩展方法

	    /// <summary>
	    /// 根据店铺ID获取公告列表
	    /// </summary>
	    /// <param name="shopId"></param>
	    /// <returns></returns>
	    public List<ShopNotice> GetModelListByShopId(int shopId)
	    {
	        return ShopNoticeDAL.Instance.GetModelListByShopId(shopId);
	    }
		#endregion
	}
}